JBoss Community Archive (Read Only)

Mobicents

Accessing JMX Beans Attributes

Description

This section will guide through the GetRequest and SetRequest  SNMP PDUs and how they map to JMX attributes and the JBoss SNMP Adaptor. Each of them will go through the scalar objects only (Long, AtomicLong, Boolean, AtomicBoolean, String, Integer, AtomicInteger) and tabular objects (java.util.List, java.util.Map and arrays the following primitive types int, long, boolean or same supported Object as for the scalar objects). net-snmp will act as a manager and JBoss Application Server SNMP Resource Adaptor as the Agent. The JBoss Application Server SNMP Adaptor is exposing out of the box a certain number of MBean and their attributes in SNMP Adaptor Attributes configuration file . The following MBean will be used as an example for scalar objects :

   <!- system information group see RFC-1213 ->
   <mbean name="jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup" oid-prefix=".1.3.6.1.2.1.1">
      <attribute name="SysDescr" oid=".1" mode="rw"/> <!- can be modified over snmp as mode is rw ->
      <attribute name="SysObjectId" oid=".2"/>
      <attribute name="SysUpTime" oid=".3"/>
      <attribute name="SysContact" oid=".4"/>
      <attribute name="SysName" oid=".5"/>
      <attribute name="SysLocation" oid=".6"/>
      <attribute name="SysServices" oid=".7"/>
   </mbean>

Make sure JBoss Application Server is started on 127.0.0.1 before trying the following commands. Please remember that the walkthrough is using the user TEST with password maplesyrup and that the SNMP Adaptor runs with the default configuration ie its agent will be listening on ip address 127.0.0.1 and port 1161

Exposing a JMX Attribute as Scalar Object and reading its value through SNMP GetRequest

To Request the SysDescr attribute of the jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup, the OID that has to be queried is the concatenation of the oid-prefix, the oid of the attribute and .0 as it is a scalar attribute so the following command should be issued

snmpget -v 3 -u TEST -a MD5 -A "maplesyrup" -x DES -X "maplesyrup" -l authPriv 127.0.0.1:1161 .1.3.6.1.2.1.1.1.0

which will give the following output

iso.3.6.1.2.1.1.1.0 = STRING: "JBoss Application Server"

Exposing a JMX Attribute as Scalar Object and setting its value through SNMP SetRequest

To Modify the SysDescr attribute of the jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup, the OID that has to be queried is the concatenation of the oid-prefix, the oid of the attribute and .0 as it is a scalar attribute so the following command should be issued

 snmpset -v 3 -u TEST -a MD5 -A "maplesyrup" -x DES -X "maplesyrup" -l authPriv 127.0.0.1:1161 .1.3.6.1.2.1.1.1.0 s "JBoss Application Server Rocks"

which will give the following output

iso.3.6.1.2.1.1.1.0 = STRING: "JBoss Application Server Rocks"

Discovering the next OID/JMX Attribute to query through SNMP GetNextRequest

SNMP allows you to know what is the next OID to query through the GetNextRequest PDU. So to know what is the next attribute after SysDescr the following query should be issued :

snmpgetnext -v 3 -u TEST -a MD5 -A "maplesyrup" -x DES -X "maplesyrup" -l authPriv 127.0.0.1:1161 .1.3.6.1.2.1.1.1.0

which will give the following output

iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.2312.100.9.1.1.6

Note that as opposed to the GetRequest PDU, the response does not contain the same OID as was in the query but the next OID along with its value, so through this command it is possible to iterate through the whole MIB. It is also very useful to iterate through table as will be shown in Accessing JMX Beans Attributes as Tables

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 11:41:58 UTC, last content change 2011-07-12 15:08:16 UTC.